package com.iris.live.services.common.enumpack;

/**
 * RoleAuthorityEnum
 *
 * @author penf
 * @Description 角色权限枚举
 * @date 2018-01-05 15:05
 */
public enum RoleAuthorityEnum {
    /**
     * 管理员
     */
    Admin("管理员","roleLevelGroup",0),
    /**
     * 集团
     */
    Group("集团","roleLevelGroup",1),
    /**
     * 大区
     */
    Area("大区","roleLevelArea",2),
    /**
     * PMA
     */
    PMA("PMA","roleLevelCta",3),
    /**
     * 经销商
     */
    Dealer("经销商","roleLevelDealer",4);


    public String code;
    public String value;
    public Integer important;

    /**
     * 获取角色权限值
     * @param code
     * @return String value
     */
    public static String getValueByCode(String code){
        for (RoleAuthorityEnum obj : RoleAuthorityEnum.values()){
            if(code.equals(obj.getcode())){
                return obj.getvalue();
            }
        }
        return null;
    }

    RoleAuthorityEnum(String code, String value, Integer important) {
        this.code = code;
        this.value = value;
        this.important = important;
    }

    public String getcode() {
        return code;
    }

    public void setcode(String code) {
        this.code = code;
    }

    public String getvalue() {
        return value;
    }

    public void setvalue(String value) {
        this.value = value;
    }

    public Integer getImportant() {
        return important;
    }

    public void setImportant(Integer important) {
        this.important = important;
    }

    @Override
    public String toString() {
        return "RoleAuthorityEnum{" +
                "code='" + code + '\'' +
                ", value='" + value + '\'' +
                ", important=" + important +
                '}';
    }
}
